import requests
import httpx


async def mdxnet_post(info):
    send_chat_info = {
        # 定义处理流程的参数
        "model_path": info.model,
        "inp_path": info.input,
        "save_root_vocal": "E:\\PycharmProject\\ai-voice-cloning\\data\\测试\\uvr5_opt",
        "save_root_ins": "E:\\PycharmProject\\ai-voice-cloning\\data\\测试\\uvr5_opt",
        "format0": info.format
    }
    chat_url = 'http://127.0.0.1:9880/mdxnet'

    response = requests.post(chat_url, json=send_chat_info)
    response.raise_for_status()
    mdxnet_return_info = response.json()
    print(mdxnet_return_info)
    if mdxnet_return_info.get('code') == 200 and mdxnet_return_info.get('success') is True:
        return True, mdxnet_return_info.get('data')
    else:
        return False, {}
